#pragma once
#include<unistd.h>
#include<fcntl.h>
#include<cstdlib>

#define NON_BLOCK_ERR 20

void SetNonBlock(int sockfd)
{
    int fl = fcntl(sockfd,F_GETFL);
    if(fl < 0)
        exit(NON_BLOCK_ERR);
    
    fcntl(sockfd,F_SETFL,fl | O_NONBLOCK);
}